package com.gxa.customer.controller;

import com.fasterxml.jackson.databind.deser.impl.CreatorCandidate;
import com.gxa.common.commons.R;
import com.gxa.common.params.AddPartnerParam;
import com.gxa.common.params.QueryPartnerParam;
import com.gxa.common.params.UpdatePrParam;
import com.gxa.customer.service.PartnerService;
import org.apache.ibatis.annotations.UpdateProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/partner")
public class  PartnerController {
    @Autowired
    private PartnerService partnerService;

    /**
     * 添加合作方
     * @param param
     * @return
     */
    @PostMapping("/addPartner")
    public R addHouse(@RequestBody AddPartnerParam param){
        return partnerService.addPartner(param);
    }

    /**
     * 查询合作方（支持条件无条件）
     * @param param
     * @return
     */
    @PostMapping("/queryPartner")
    public R queryPartner(@RequestBody QueryPartnerParam param){
        return partnerService.queryPartner(param);
    }

    /**
     * 编辑合作方信息
     * @param param
     * @return
     */
    @PostMapping("/updatePartner")
    public R updatePartner(@RequestBody UpdatePrParam param){
        return partnerService.updatePartner(param);
    }

    /**
     * 根据合作方信息显示合作方信息和全部合作的客户
     * @param id
     * @return
     */
    @PostMapping("/findCustomerListByPartnerInfo")
    public R findCustomerListByPartnerInfo(Long id,Integer currentPage, Integer pageSize){
        return partnerService.findCustomerListByPartnerInfo(id,currentPage,pageSize);
    }
}
